1. Field of the Invention
The present invention relates generally to optimization of computer programs and more particularly to efficient performance of optimizing compilation.
2. Related Art
Current global scalar optimization technology requires the compiler to transform a source code program into an equivalent intermediate representation (IR). Based on the IR, the compiler then generates additional information about the program, e.g., the places in the program where each variable is defined and used (referred to as use-def information). A global scalar optimization procedure uses the IR and the program information to transform the IR. This transformed version of the IR, once compiled, should execute more quickly than the original version of the program. In this sense, the program has undergone an optimization during compilation.
Some global scalar optimizations, however, fail to transform the program information when they transform the IR into a new IR. If so, the program information, which has not been transformed, is no longer useful for purposes of subsequent optimization. If additional optimizations are to be performed, they must be performed on the current, transformed version of the IR, to which the previously generated program information no longer corresponds. That program information is now irrelevant. Hence an additional optimization will require that new program information be generated, based on the new IR, before this IR can be further optimized. Therefore, any optimization that transforms the current version of the IR only, and, in so doing, renders the existing program information obsolete, necessitates regeneration of the program information if subsequent optimization is required. This regeneration represents costly overhead each time a subsequent global scalar optimization procedure is performed.
Therefore, what is needed is a method, system, and computer program product for global scalar optimization that operates on a source program to produce an IR and its associated program information, where each optimization procedure transforms the program information as well as the IR. This would allow performance of subsequent optimization procedures without having to regenerate updated program information each time.